/*
 * Created: Author: Aléx Carvalho / Date: Jan 28, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-05-06 00:26:37 +0000 (Wed, 06 May 2015) $
 */
package com.cpm.repository.jpa;

import com.cpm.entities.Competence;
import com.cpm.repository.CompetenceRepository;
import java.util.Properties;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.batch.runtime.JobExecution;

public class CompetenceRepositoryJpa extends GenericCrudRepositoryJpa<Competence> implements CompetenceRepository {

    @Override
    public void postUpdate(Competence value) {
        JobOperator jobOperator = BatchRuntime.getJobOperator();

        Properties properties = new Properties();
        properties.setProperty("indicatorId", value.getIndicator().getId().toString());
        properties.setProperty("competencePeriod", value.getPeriod().toString());

        Long executionId = jobOperator.start("performance", properties);
        JobExecution jobExecution = jobOperator.getJobExecution(executionId);
    }
}
